import javax.swing.*;
import java.net.*;
import java.awt.*;
import java.io.*;

/*
 * 		I MADE A GRID DERP
 *  	Is now JavaDoc
 */



public class GameClient extends JFrame{
	public static void main(String args[]){
		new GameClient();
	}

	public GameClient(){

		JFrame f = new JFrame("Monster Muncher");
		Container c = f.getContentPane();
		c.setLayout(new GridBagLayout());
		final int width = 9, height = 9;

		GridBagConstraints gbc = new GridBagConstraints();

		JLabel[][] label = new JLabel[width][height];
		for(int i = 0; i < width; i++) {
			for(int j = 0; j < height; j++) {
				boolean isStage = true;
				label[i][j] = new JLabel();
				//label[i][j].setText("Co-Ords " + i + "," + j);
				label[i][j].setBorder(BorderFactory.createLineBorder(Color.BLACK));
				label[i][j].setPreferredSize(new Dimension(80, 80));
				label[i][j].setOpaque(true);
				
				if ((i > 0 && i < 8) && i != 4 ){
					if ((j > 0 && j < 8) && j != 4){
						isStage = false;
					}
				}
				
				if (isStage == false){
					label[i][j].setBackground(Color.BLACK);
				}
				else {
					label[i][j].setBackground(Color.WHITE);
				}
				
				gbc.gridx = j+1;
				gbc.gridy = i+1;
				c.add(label[i][j], gbc);
			}
		}

		//	        c.addComponentListener(new ComponentAdapter() {
		//	            @Override
		//	            public void componentResized(ComponentEvent e) {
		//	                final Component comp = e.getComponent();
		//	                final int newSize = Math.min(comp.getHeight() / h, comp.getWidth() / w);
		//	                final Dimension newDim = new Dimension(newSize, newSize);
		//	                for(int i = 0; i < w; ++i) {
		//	                    for(int j = 0; j < h; ++j) {
		//	                        label[i][j].setMaximumSize(newDim);
		//	                        label[i][j].setMinimumSize(newDim);
		//	                        label[i][j].setPreferredSize(newDim);
		//	                    }
		//	                }
		//	                comp.invalidate();
		//	            }
		//	        });

		f.pack();
		f.setResizable(false);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setVisible(true);
	}
}
